package com.huan.spring.resource.controller;

import com.huan.spring.resource.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;

@Controller("myUserController") //发生冲突时可以设置value来避免
public class UserController {
    //根据名称进行注入
//    @Resource(name = "myUserServiceImpl")
//    private UserService userService;

    //根据类型进行注入
    @Resource
    private UserService userService;

    public void add(){
        System.out.println("controller....");
        userService.add();
    }
}
